package interceptor;

import java.util.Map;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
/**
 * UserAction
 *
 */
public class LoggedInInterceptor extends MethodFilterInterceptor {

	@Override
	protected String doIntercept(ActionInvocation invocation) throws Exception {
		Map<String,Object> session = invocation.getInvocationContext().getSession();
		String resultCode = "";
		if(session.get("user") != null){
			resultCode = invocation.invoke();//执行后续拦截器或Action业务方法
		}else{
			resultCode = "notLoggedIn";
		}
		return resultCode;
	}

}
